package dao

import (
	"time"
)

// 这是 OmsOrder 的全局公开dao对象，被service层调用!
var OmsOrderDao = omsOrderDao{}

// 这是 oms_order表 的实体类
type OmsOrder struct {
	AutoConfirmDay        int32     `json:"auto_confirm_day" form:"auto_confirm_day" v:"auto_confirm_day"`          // 自动确认时间（天）
	BillContent           string    `json:"bill_content" form:"bill_content" v:"bill_content"`                      // 发票内容
	BillHeader            string    `json:"bill_header" form:"bill_header" v:"bill_header"`                         // 发票抬头
	BillReceiverEmail     string    `json:"bill_receiver_email" form:"bill_receiver_email" v:"bill_receiver_email"` // 收票人邮箱
	BillReceiverPhone     string    `json:"bill_receiver_phone" form:"bill_receiver_phone" v:"bill_receiver_phone"` // 收票人电话
	BillType              int32     `json:"bill_type" form:"bill_type" v:"bill_type"`                               // 发票类型：0-&gt;不开发票；1-&gt;电子发票；2-&gt;纸质发票
	CommentTime           time.Time `json:"comment_time" form:"comment_time" v:"comment_time"`                      // 评价时间
	ConfirmStatus         int32     `json:"confirm_status" form:"confirm_status" v:"confirm_status"`                // 确认收货状态：0-&gt;未确认；1-&gt;已确认
	CouponAmount          float64   `json:"coupon_amount" form:"coupon_amount" v:"coupon_amount"`                   // 优惠券抵扣金额
	CouponId              int64     `json:"coupon_id" form:"coupon_id" v:"coupon_id"`
	CreateTime            time.Time `json:"create_time" form:"create_time" v:"create_time"`                      // 提交时间
	DeleteStatus          int32     `json:"delete_status" form:"delete_status" v:"delete_status"`                // 删除状态：0-&gt;未删除；1-&gt;已删除
	DeliveryCompany       string    `json:"delivery_company" form:"delivery_company" v:"delivery_company"`       // 物流公司(配送方式)
	DeliverySn            string    `json:"delivery_sn" form:"delivery_sn" v:"delivery_sn"`                      // 物流单号
	DeliveryTime          time.Time `json:"delivery_time" form:"delivery_time" v:"delivery_time"`                // 发货时间
	DiscountAmount        float64   `json:"discount_amount" form:"discount_amount" v:"discount_amount"`          // 管理员后台调整订单使用的折扣金额
	FreightAmount         float64   `json:"freight_amount" form:"freight_amount" v:"freight_amount"`             // 运费金额
	Growth                int32     `json:"growth" form:"growth" v:"growth"`                                     // 可以活动的成长值
	Id                    int64     `json:"id" form:"id" v:"id"`                                                 // 订单id
	Integration           int32     `json:"integration" form:"integration" v:"integration"`                      // 可以获得的积分
	IntegrationAmount     float64   `json:"integration_amount" form:"integration_amount" v:"integration_amount"` // 积分抵扣金额
	MemberId              int64     `json:"member_id" form:"member_id" v:"member_id"`
	MemberUsername        string    `json:"member_username" form:"member_username" v:"member_username"`                         // 用户帐号
	ModifyTime            time.Time `json:"modify_time" form:"modify_time" v:"modify_time"`                                     // 修改时间
	Note                  string    `json:"note" form:"note" v:"note"`                                                          // 订单备注
	OrderSn               string    `json:"order_sn" form:"order_sn" v:"order_sn"`                                              // 订单编号
	OrderType             int32     `json:"order_type" form:"order_type" v:"order_type"`                                        // 订单类型：0-&gt;正常订单；1-&gt;秒杀订单
	PayAmount             float64   `json:"pay_amount" form:"pay_amount" v:"pay_amount"`                                        // 应付金额（实际支付金额）
	PayTime               time.Time `json:"pay_time" form:"pay_time" v:"pay_time"`                                              // 支付时间
	PayType               int32     `json:"pay_type" form:"pay_type" v:"pay_type"`                                              // 支付方式：0-&gt;未支付；1-&gt;支付宝；2-&gt;微信
	PromotionAmount       float64   `json:"promotion_amount" form:"promotion_amount" v:"promotion_amount"`                      // 促销优化金额（促销价、满减、阶梯价）
	PromotionInfo         string    `json:"promotion_info" form:"promotion_info" v:"promotion_info"`                            // 活动信息
	ReceiveTime           time.Time `json:"receive_time" form:"receive_time" v:"receive_time"`                                  // 确认收货时间
	ReceiverCity          string    `json:"receiver_city" form:"receiver_city" v:"receiver_city"`                               // 城市
	ReceiverDetailAddress string    `json:"receiver_detail_address" form:"receiver_detail_address" v:"receiver_detail_address"` // 详细地址
	ReceiverName          string    `json:"receiver_name" form:"receiver_name" v:"receiver_name"`                               // 收货人姓名
	ReceiverPhone         string    `json:"receiver_phone" form:"receiver_phone" v:"receiver_phone"`                            // 收货人电话
	ReceiverPostCode      string    `json:"receiver_post_code" form:"receiver_post_code" v:"receiver_post_code"`                // 收货人邮编
	ReceiverProvince      string    `json:"receiver_province" form:"receiver_province" v:"receiver_province"`                   // 省份/直辖市
	ReceiverRegion        string    `json:"receiver_region" form:"receiver_region" v:"receiver_region"`                         // 区
	SourceType            int32     `json:"source_type" form:"source_type" v:"source_type"`                                     // 订单来源：0-&gt;PC订单；1-&gt;app订单
	Status                int32     `json:"status" form:"status" v:"status"`                                                    // 订单状态：0-&gt;待付款；1-&gt;待发货；2-&gt;已发货；3-&gt;已完成；4-&gt;已关闭；5-&gt;无效订单
	TotalAmount           float64   `json:"total_amount" form:"total_amount" v:"total_amount"`                                  // 订单总金额
	UseIntegration        int32     `json:"use_integration" form:"use_integration" v:"use_integration"`                         // 下单时使用的积分
}

// 注意:这是 OmsOrder 的私有dao对象，只能在dao层内使用!
type omsOrderDao struct {
	InsertTemplate func(arg OmsOrder) (int64, error)                               //插入一条记录
	UpdateTemplate func(arg OmsOrder) (int64, error)                               //更新一条记录
	DeleteTemplate func(id int64) (int64, error)                                   `args:"id"`                         //根据传入的主键删除一条记录
	SelectTemplate func(id int64) (OmsOrder, error)                                `args:"id"`                         //根据传入的主键获取一条记录
	List           func(keyword string, pageNum, pageSize int) ([]OmsOrder, error) `args:"keyword,page_num,page_size"` //模糊分页查询
}

/*
// 这是 oms_order 表的Postman测试参数
// 该结构体中的字段就是: 前后端交互的json字段!
type OmsOrderPostman struct {
auto_confirm_day
bill_content
bill_header
bill_receiver_email
bill_receiver_phone
bill_type
comment_time
confirm_status
coupon_amount
coupon_id
create_time
delete_status
delivery_company
delivery_sn
delivery_time
discount_amount
freight_amount
growth
id
integration
integration_amount
member_id
member_username
modify_time
note
order_sn
order_type
pay_amount
pay_time
pay_type
promotion_amount
promotion_info
receive_time
receiver_city
receiver_detail_address
receiver_name
receiver_phone
receiver_post_code
receiver_province
receiver_region
source_type
status
total_amount
use_integration

}*/

// 这是 oms_order 表的批量请求参数
type OmsOrderReq struct {
	List []OmsOrder `json:"list" form:"list"`
}
